<?php

class WebApplication
{
    private $name = null;
    private $user = null;

    private static $defaultUserClass = null;

    public function __construct( $name = 'site' )
    {
        if ( empty( $name ) )
        {
            $name = 'site';
        }
        $this->name = $name;

        if ( empty( self::$defaultUserClass ) )
        {
            self::$defaultUserClass = 'SiteUser';
        }

        $userClass = $this->name != 'site' ? ucfirst($this->name) . 'User' : self::$defaultUserClass;
        $this->user = new $userClass;
    }

    public function GetName()
    {
        return $this->name;
    }

    /**
     * @return WebUser
     */
    public function GetUser()
    {
        return $this->user;
    }

    /**
     * @param string $class
     */
    public static function SetDefaultUserClass($class)
    {
        self::$defaultUserClass = $class;
    }
}